// Package utils /**
package utils

const (
	RecodeOk         = "0"
	RecodeDberr      = "4001"
	RecodeNodata     = "4002"
	RecodeDataexist  = "4003"
	RecodeDataerr    = "4004"
	RecodeSessionerr = "4101"
	RecodeLoginerr   = "4102"
	RecodeParamerr   = "4103"
	RecodeUsererr    = "4104"
	RecodeRoleerr    = "4105"
	RecodePwderr     = "4106"
	RecodeUserExist  = "4107"
	RecodeMobileErr  = "4018"
	RecodeSmsError   = "4019"
	RecodeReqerr     = "4201"
	RecodeIperr      = "4202"
	RecodeThirderr   = "4301"
	RecodeIoerr      = "4302"
	RecodeServererr  = "4500"
	RecodeUnknowerr  = "4501"
)

var recodeText = map[string]string{
	RecodeOk:         "成功",
	RecodeDberr:      "数据库查询错误",
	RecodeNodata:     "无数据",
	RecodeDataexist:  "数据已存在",
	RecodeDataerr:    "数据错误",
	RecodeSessionerr: "用户未登录",
	RecodeLoginerr:   "用户登录失败",
	RecodeParamerr:   "参数错误",
	RecodeUsererr:    "用户不存在或未激活",
	RecodeRoleerr:    "用户身份错误",
	RecodeUserExist:  "用户已存在",
	RecodePwderr:     "密码错误",
	RecodeMobileErr:  "手机号错误",
	RecodeSmsError:   "短信错误",
	RecodeReqerr:     "非法请求或请求次数受限",
	RecodeIperr:      "IP受限",
	RecodeThirderr:   "第三方系统错误",
	RecodeIoerr:      "文件读写错误",
	RecodeServererr:  "内部错误",
	RecodeUnknowerr:  "未知错误",
}

func RecodeText(code string) string {
	str, ok := recodeText[code]
	if ok {
		return str
	}
	return recodeText[RecodeUnknowerr]
}
